#include <bits/stdc++.h>
using namespace std;


void qsort(int a[], int l, int r) {
    if (l >= r)
        return;
    int p = a[l];
    while (l < r) {
        while (l < r && a[r] >= p)
            --r;
        a[l] = a[r];
        while (l < r && a[l] <= p)
            ++l;
        a[r] = a[l];
    }
    a[l] = p;
    qsort(a, l, p-1);
    qsort(a, p+1, r);
}